{ config, lib, pkgs, ... }:
with lib;
{
  config = mkIf (config.roles.desktop == "gnome") {
    services = {
      displayManager.defaultSession = "gnome";
      xserver = {
        desktopManager.gnome = {
          enable = true;
          sessionPath = (with pkgs; [
            adw-gtk3
          ]) ++ (with pkgs.gnomeExtensions; [
            alphabetical-app-grid
            bing-wallpaper-changer
            caffeine
          ]);
        };
        displayManager.gdm = {
          enable = true;
          autoSuspend = false;
          wayland = true;
        };
      };
    };

    qt = {
      enable = true;
      platformTheme = "gnome";
      style = "adwaita-dark";
    };

    environment.gnome.excludePackages = with pkgs; [
      at-spi2-atk
      at-spi2-core
      gnome-connections
      gnome-console
      gnome-photos
      gnome-tour
      baobab
      epiphany
      evolution-data-server
      gnome-contacts
      gnome-font-viewer
      gnome-maps
      gnome-music
      gnome-software
      rygel
      simple-scan
      totem
      yelp
    ];
  };
}
